home *** CD-ROM | disk | FTP | other *** search
/ Atari Mega Archive 2 / Atari Mega Archive CD - Volume 2.iso / minix / up1510b.tgz / up1510b / include / termios.h < prev    next >
C/C++ Source or Header  |  1990-07-23  |  6KB  |  132 lines

  1. /* The <termios.h> header is used for controlling tty modes. */
  2.  
  3. #ifndef _TERMIOS_H
  4. #define _TERMIOS_H
  5.  
  6. typedef unsigned short tcflag_t;
  7. typedef unsigned char cc_t;
  8. typedef unsigned int speed_t;
  9.  
  10. #define NCCS        11    /* size of cc_c array */
  11.  
  12. /* Primary terminal control structure. POSIX Table 7-1. */
  13. struct termios {
  14.   tcflag_t c_iflag;        /* input modes */
  15.   tcflag_t c_oflag;        /* output modes */
  16.   tcflag_t c_cflag;        /* control modes */
  17.   tcflag_t c_lflag;        /* local modes */
  18.   speed_t  c_ispeed;        /* input speed */
  19.   speed_t  c_ospeed;        /* output speed */
  20.   cc_t c_cc[NCCS];        /* control characters */
  21. };
  22.  
  23. /* Values for termios c_iflag bit map.  POSIX Table 7-2. */
  24. #define BRKINT        000001    /* signal interrupt on break */
  25. #define ICRNL         000002    /* map CR to NL on input */
  26. #define IGNBRK        000004    /* ignore break */
  27. #define IGNCR         000010    /* ignore CR */
  28. #define IGNPAR        000020    /* ignore characters with parity errors */
  29. #define INLCR         000100    /* map NL to CR on input */
  30. #define INPCK         000200    /* enable input parity check */
  31. #define ISTRIP        000400    /* mask off 8th bit */
  32. #define IXOFF         001000    /* enable start/stop input control */
  33. #define IXON          002000    /* enable start/stop output control */
  34. #define PARMRK        004000    /* mark parity errors in the input queue */
  35.  
  36. /* Values for termios c_oflag bit map.  POSIX Sec. 7.1.2.3. */
  37. #define OPOST         000001    /* perform output processing */
  38.  
  39. /* Values for termios c_cflag bit map.  POSIX Table 7-3. */
  40. #define CLOCAL        000001    /* ignore modem status lines */
  41. #define CREAD         000002    /* enable receiver */
  42. #define CSIZE         000014    /* number of bits per character */
  43. #define CSTOPB        000020    /* send 2 stop bits if set, else 1 */
  44. #define HUPCL         000040    /* hang up on last close */
  45. #define PARENB        000100    /* enable parity on output */
  46. #define PARODD        000200    /* use odd parity if set, else even */
  47.  
  48. #define CS5           000000    /* if CSIZE is CS5, characters are 5 bits */
  49. #define CS6           000004    /* if CSIZE is CS6, characters are 6 bits */
  50. #define CS7           000010    /* if CSIZE is CS7, characters are 7 bits */
  51. #define CS8           000014    /* if CSIZE is CS8, characters are 8 bits */
  52.  
  53. /* Values for termios c_lflag bit map.  POSIX Table 7-4. */
  54. #define ECHO          000001    /* enable echoing of input characters */
  55. #define ECHOE         000002    /* echo ERASE as backspace */
  56. #define ECHOK         000004    /* echo KILL */
  57. #define ECHONL        000010    /* echo NL */
  58. #define ICANON        000020    /* canonical input (erase and kill enabled) */
  59. #define IEXTEN        000040    /* enable extended functions */
  60. #define ISIG          000100    /* enable signals */
  61. #define NOFLSH        000200    /* disable flush after interrupt or quit */
  62. #define TOSTOP        000400    /* send SIGTTOU (job control, not implemented*/
  63.  
  64. /* Indices into c_cc array.  Default values in parentheses. POSIX Table 7-5. */
  65. #define VEOF               0    /* cc_c[VEOF] = EOF char (CTRL-D) */
  66. #define VEOL               1    /* cc_c[VEOL] = EOL char (??) */
  67. #define VERASE             2    /* cc_c[VERASE] = ERASE char (CTRL-H) */
  68. #define VINTR              3    /* cc_c[VINTR] = INTR char (DEL) */
  69. #define VKILL              4    /* cc_c[VKILL] = KILL char (@) */
  70. #define VMIN               5    /* cc_c[VMIN] = MIN value for timer */
  71. #define VQUIT              6    /* cc_c[VQUIT] = QUIT char (CTRL-\) */
  72. #define VTIME              7    /* cc_c[VTIME] = TIME value for timer */
  73. #define VSUSP              8    /* cc_c[VSUSP] = SUSP (job control, not impl */
  74. #define VSTART             9    /* cc_c[VSTART] = START char (always CTRL-S) */
  75. #define VSTOP             10    /* cc_c[VSTOP] = STOP char (always CTRL-Q) */
  76.  
  77. /* Values for the baud rate settings.  POSIX Table 7-6. */
  78. #define B0           0000000    /* hang up the line */
  79. #define B50          0010000    /* 50 baud */
  80. #define B75          0020000    /* 75 baud */
  81. #define B110         0030000    /* 110 baud */
  82. #define B134         0040000    /* 134.5 baud */
  83. #define B150         0050000    /* 150 baud */
  84. #define B200         0060000    /* 200 baud */
  85. #define B300         0070000    /* 300 baud */
  86. #define B600         0100000    /* 600 baud */
  87. #define B1200        0110000    /* 1200 baud */
  88. #define B1800        0120000    /* 1800 baud */
  89. #define B2400        0130000    /* 2400 baud */
  90. #define B4800        0140000    /* 4800 baud */
  91. #define B9600        0150000    /* 9600 baud */
  92. #define B19200       0160000    /* 19200 baud */
  93. #define B38400       0170000    /* 38400 baud */
  94.  
  95. /* Optional actions for tcsetattr().  POSIX Sec. 7.2.1.2. */
  96. #define TCSANOW            1    /* changes take effect immediately */
  97. #define TCSADRAIN          2    /* changes take effect after output is done */
  98. #define TCSAFLUSH          3    /* wait for output to finish and flush input */
  99.  
  100. /* Queue_selector values for tcflush().  POSIX Sec. 7.2.2.2. */
  101. #define TCIFLUSH           1    /* flush accumulated input data */
  102. #define TCOFLUSH           2    /* flush accumulated output data */
  103. #define TCIOFLUSH          3    /* flush accumulated input and output data */
  104.  
  105. /* Action values for tcflow().  POSIX Sec. 7.2.2.2. */
  106. #define TCOOFF             1    /* suspend output */
  107. #define TCOON              2    /* restart suspended output */
  108. #define TCIOFF             3    /* transmit a STOP character on the line */
  109. #define TCION              4    /* transmit a START character on the line */
  110.  
  111.  
  112. /* Function Prototypes. */
  113. #ifndef _ANSI_H
  114. #include <ansi.h>
  115. #endif
  116.  
  117. _PROTOTYPE( int tcsendbreak, (int _fildes, int _duration)             );
  118. _PROTOTYPE( int tcdrain, (int _filedes)                     );
  119. _PROTOTYPE( int tcflush, (int _filedes, int _queue_selector)             );
  120. _PROTOTYPE( int tcflow, (int _filedes, int _action)                 );
  121. _PROTOTYPE( speed_t cfgetospeed, (struct termios *_termios_p)              );
  122. _PROTOTYPE( speed_t cfsetospeed, \
  123.                 (struct termios *_termios_p, speed_t _speed)       );
  124. _PROTOTYPE( speed_t cfgetispeed, (struct termios *_termios_p)              );
  125. _PROTOTYPE( speed_t cfsetispeed, \
  126.             (struct termios *_termios_p, speed_t _speed)       );
  127. _PROTOTYPE( int tcgetattr, (int _filedes, struct termios *_termios_p)      );
  128. _PROTOTYPE( int tcsetattr, \
  129.     (int _filedes, int _opt_actions, struct termios *_termios_p)      );
  130.  
  131. #endif /* _TERMIOS_H */
  132.